package com.eeepay.eeepay_v2.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述：超级推收入查询的view 适配器
 * 作者：zhuangzeqin
 * 时间: 2017/7/19-17:23
 * 邮箱：zzq@eeepay.cn
 */
public class CJTTabAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mFragmentTab = new ArrayList<>();

    public CJTTabAdapter(FragmentManager fm) {
        super(fm);
    }

    public void setListFragments(List<Fragment> list) {
        mFragmentTab.clear();
        mFragmentTab.addAll(list);
        notifyDataSetChanged();
    }

    /**
     * 获取Fragment 实例
     *
     * @param position
     * @return
     */
    @Override
    public Fragment getItem(int position) {
        return mFragmentTab.get(position);
    }

    /**
     * 数量
     *
     * @return
     */
    @Override
    public int getCount() {
        return mFragmentTab.size();
    }

    /**
     * 页面标题
     *
     * @param position
     * @return
     */
    @Override
    public CharSequence getPageTitle(int position) {
        String recordStatus;
        if (position==0)
            recordStatus = "交易收益";
        else if (position==1)
            recordStatus = "邀请好友奖励";
        else
            recordStatus ="";
        return recordStatus;
    }
}
